/*
    4. Write a C program to calculate x raised to the power n (xn). 
    Example:
    Input:
    x = 7.0
    n = 2

    x = 6.2
    n = 3
    Output:
    Result:(x^n) : 49.000000
    Result:(x^n) : 238.328000
*/

#include <stdio.h>

float pow(float x, int n)
{
    float result = 1;
    while(n--){
        result *= x;
    }
    return result;
}

int main(void)
{
    float x = 0;
    int n = 0;
    printf("Input:\n");
    printf("x = ");
    scanf("%f", &x);
    printf("n = ");
    scanf("%d", &n);
    printf("Output:\n");
    printf("Result:(x^n) : %f\n", pow(x, n));    
    return 0;
}
